using System;
using System.Threading.Tasks;
using System.Linq;
using ExamServer.Entities;
using Microsoft.EntityFrameworkCore;

namespace ExamServer.Service
{
  public class UsersRepository : RepositoryBase<Users, Guid>, 
                               IUsersRepository
  {
      public UsersRepository(DbContext dbContext)
      :base(dbContext)
      {
          
      }
      public  async Task<Users> Login(string name, string pwd)
      {
        var user = await dbContext.Set<Users>().FirstOrDefaultAsync(
            x=>x.Name==name && 
            x.Password==pwd);
      return user;
    }
  }
}
